// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) ansi lnc 

package com.example.airkissdemo.network;

import android.util.Log;
import java.io.IOException;
import java.net.*;

public class UDPClientSingleton
{

    private UDPClientSingleton()
    {
        mClientSocket = new DatagramSocket();
_L1:
        return;
        SocketException socketexception;
        socketexception;
        Log.e("AirKissDemo.UDPClientSingleton", "new DatagramSocket error");
        socketexception.printStackTrace();
          goto _L1
    }

    public static UDPClientSingleton instance()
    {
        if(mUdpClientSingleton == null)
            mUdpClientSingleton = new UDPClientSingleton();
        return mUdpClientSingleton;
    }

    protected void finalize()
        throws Throwable
    {
        mClientSocket.close();
        super.finalize();
    }

    public int sendData(byte abyte0[], int i, String s, int j, long l)
    {
        if(abyte0 != null && i > 0) goto _L2; else goto _L1
_L1:
        byte byte0;
        Log.e("AirKissDemo.UDPClientSingleton", "sendData input error");
        byte0 = -1;
_L4:
        return byte0;
_L2:
        byte0 = 0;
        DatagramPacket datagrampacket = new DatagramPacket(abyte0, i, InetAddress.getByName(s), j);
        mClientSocket.send(datagrampacket);
        try
        {
            Log.v("AirKissDemo.UDPClientSingleton", "udp send");
            Thread.sleep(l);
        }
        catch(InterruptedException interruptedexception)
        {
            try
            {
                Log.e("AirKissDemo.UDPClientSingleton", (new StringBuilder("Thread sleep failed ")).append(interruptedexception.getMessage()).toString());
                interruptedexception.printStackTrace();
            }
            catch(UnknownHostException unknownhostexception)
            {
                Log.e("AirKissDemo.UDPClientSingleton", "InetAddress.getByName error");
                unknownhostexception.printStackTrace();
            }
            catch(IOException ioexception)
            {
                Log.e("AirKissDemo.UDPClientSingleton", "DatagramSocket.send error");
                ioexception.printStackTrace();
                byte0 = -1;
            }
        }
        if(true) goto _L4; else goto _L3
_L3:
    }

    private static final String TAG = "AirKissDemo.UDPClientSingleton";
    private static UDPClientSingleton mUdpClientSingleton;
    private DatagramSocket mClientSocket;
}
